#include"Comm.hpp"

int main(){
    key_t key = getkey(); //获取key
    int shm_id = getshm(key); //获取shm
    char* shm_addr = (char*)shmattach(shm_id);//挂起
    //写
    const char* message = "我是客户端,我正在想服务端发信息";
    int cnt = 1;
    while(true){
        //TODO
        snprintf(shm_addr,MAX_SIZE,"%s[pid:%d][发送计数:%d]",message,getpid(),cnt++);
        sleep(1);
    }
    
    shmdetach(shm_addr);//取消挂起
    return 0;
}